﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AGameOfThrones.messages
{
    public class request_movepiece : message
    {
        private game.position _oldposition = new game.position();
        public game.position OldPosition
        {
            get { return _oldposition; }
            set { _oldposition = value; }
        }

        private game.position _newposition = new game.position();
        public game.position NewPosition
        {
            get { return _newposition; }
            set { _newposition = value; }
        }
        
        private String _piecename = "";
        public String PieceName
        {
            get { return _piecename; }
            set { _piecename = value; }
        }

        public override void serialize(stream.stream in_Stream)
        {
            stream.streamable oldpos = _oldposition as stream.streamable;
            stream.streamable newpos = _newposition as stream.streamable;

            in_Stream.begin("request_movepiece")
                .serialize("PieceName", ref _piecename)
                .serialize("OldPosition", ref oldpos)
                .serialize("NewPosition", ref newpos)
            .end();
        }
    }
}
